// pages/mine/mystore/product/index.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        tabindex: 0,
        tabs: ["已上架", "未上架", "选品上架"],
        product: [{
                ishot: true,
                isrecom: true,
                selected: true,
                img: "/images/card1.png",
                name: "车载按摩 2018秋季新款 英伦风百搭系带学院精品新款车载按摩",
                price: 2999,
                stock: "1500"
            },
            {
                ishot: false,
                isrecom: false,
                selected: true,
                img: "/images/card1.png",
                name: "车载按摩 2018秋季新款 英伦风百搭系带学院精品新款车载按摩",
                price: 2999,
                stock: "1500"
            },
            {
                ishot: false,
                isrecom: false,
                selected: false,
                img: "/images/card1.png",
                name: "车载按摩 2018秋季新款 英伦风百搭系带学院精品新款车载按摩",
                price: 2999,
                stock: "1500"
            },
            {
                ishot: false,
                isrecom: false,
                selected: false,
                img: "/images/card1.png",
                name: "车载按摩 2018秋季新款 英伦风百搭系带学院精品新款车载按摩",
                price: 2999,
                stock: "1500"
            },
            {
                ishot: false,
                isrecom: false,
                selected: false,
                img: "/images/card1.png",
                name: "车载按摩 2018秋季新款 英伦风百搭系带学院精品新款车载按摩",
                price: 2999,
                stock: "1500"
            },
            {
                ishot: false,
                isrecom: false,
                selected: false,
                img: "/images/card1.png",
                name: "车载按摩 2018秋季新款 英伦风百搭系带学院精品新款车载按摩",
                price: 2999,
                stock: "1500"
            },
        ]
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {

    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {

    },
    selecttap: function(e) {
        var index = e.target.dataset.index
        var temp = this.data.product
        temp[index].selected = !temp[index].selected
        this.setData({
            product: temp
        })
    },
    hottap: function(e) {
        var index = e.target.dataset.index
        var temp = this.data.product
        temp[index].ishot = !temp[index].ishot
        this.setData({
            product: temp
        })
    },
    recomtap: function(e) {
        var index = e.target.dataset.index
        var temp = this.data.product
        temp[index].isrecom = !temp[index].isrecom
        this.setData({
            product: temp
        })
    },
    tabtap: function(e) {
        this.setData({
            tabindex: e.currentTarget.dataset.index
        })
    }

})